import qdarkstyle
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QMessageBox

from src.user.UserBorrow_UI import Ui_Form
from src.user.BorrowSuccess_win import BorrowSuccess_Win


class UserBorrow_Win(QtWidgets.QMainWindow,Ui_Form):
    def __init__(self, mydb,parent=None):
        super(UserBorrow_Win, self).__init__(parent=parent)
        #ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('')
        self.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
        #self.setWindowIcon(icon)
        self.setupUi(self)
        self.mydb=mydb
        self.LoginSignal=False

    def count(self):
        data1=self.lineEdit.text()
        data=int(data1)
        price1=self.label_10.text()
        price=int(price1)
        old1=self.label_6.text()
        old=int(old1)
        price2=price*(1-old/10)*(1+data/10)
        self.label_10.setText(str(price2))

    def getMydb(self,mydb):
        self.mydb=mydb

    def myBorrowSuccess(self):
        try:
            QMessageBox.information(self,'租界成功','您已租借成功')
        except Exception as a:
            print(a)